using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace ICP_MS.Plugin.HPLC;

public class FormPeakSet : Form
{
	public double minPeakWidth = 10.0;

	public double threshold = 1000.0;

	public double minArea = 5000.0;

	public double minPeak = 1200.0;

	public bool IsPeak = true;

	public bool IsArea = false;

	private IContainer components = null;

	private Label label1;

	private Label label2;

	private Label label3;

	private Label label4;

	private TextBox textBox1;

	private TextBox textBox2;

	private TextBox textBox3;

	private TextBox textBox4;

	private Button button1;

	private Button button2;

	private CheckBox chkArea;

	private CheckBox chkPeak;

	private GroupBox groupBox1;

	private ErrorProvider errorProvider1;

	public FormPeakSet()
	{
		InitializeComponent();
	}

	private void button2_Click(object sender, EventArgs e)
	{
		if (!double.TryParse(textBox2.Text, out minPeakWidth))
		{
			errorProvider1.SetError(textBox2, Lang.Txt("HPLCForm.Text7"));
			return;
		}
		if (!double.TryParse(textBox1.Text, out threshold))
		{
			errorProvider1.SetError(textBox1, Lang.Txt("HPLCForm.Text7"));
			return;
		}
		if (!double.TryParse(textBox3.Text, out minArea))
		{
			errorProvider1.SetError(textBox3, Lang.Txt("HPLCForm.Text7"));
			return;
		}
		if (!double.TryParse(textBox4.Text, out minPeak))
		{
			errorProvider1.SetError(textBox4, Lang.Txt("HPLCForm.Text7"));
			return;
		}
		IsArea = chkArea.Checked;
		IsPeak = chkPeak.Checked;
		base.DialogResult = DialogResult.OK;
	}

	private void button1_Click(object sender, EventArgs e)
	{
		base.DialogResult = DialogResult.Cancel;
	}

	private void FormPeakSet_Load(object sender, EventArgs e)
	{
		Text = Lang.Txt("FormHPLC.Text1");
		groupBox1.Text = Lang.Txt("FormHPLC.Text2");
		label1.Text = Lang.Txt("FormHPLC.Text3");
		label2.Text = Lang.Txt("FormHPLC.Text4");
		label3.Text = Lang.Txt("FormHPLC.Text5");
		label4.Text = Lang.Txt("FormHPLC.Text6");
		button2.Text = Lang.Txt("FormSerial.OK");
		button1.Text = Lang.Txt("FormSerial.Cancel");
	}

	protected override void Dispose(bool disposing)
	{
		if (disposing && components != null)
		{
			components.Dispose();
		}
		base.Dispose(disposing);
	}

	private void InitializeComponent()
	{
		this.components = new System.ComponentModel.Container();
		this.label1 = new System.Windows.Forms.Label();
		this.label2 = new System.Windows.Forms.Label();
		this.label3 = new System.Windows.Forms.Label();
		this.label4 = new System.Windows.Forms.Label();
		this.textBox1 = new System.Windows.Forms.TextBox();
		this.textBox2 = new System.Windows.Forms.TextBox();
		this.textBox3 = new System.Windows.Forms.TextBox();
		this.textBox4 = new System.Windows.Forms.TextBox();
		this.button1 = new System.Windows.Forms.Button();
		this.button2 = new System.Windows.Forms.Button();
		this.chkArea = new System.Windows.Forms.CheckBox();
		this.chkPeak = new System.Windows.Forms.CheckBox();
		this.groupBox1 = new System.Windows.Forms.GroupBox();
		this.errorProvider1 = new System.Windows.Forms.ErrorProvider(this.components);
		this.groupBox1.SuspendLayout();
		((System.ComponentModel.ISupportInitialize)this.errorProvider1).BeginInit();
		base.SuspendLayout();
		this.label1.AutoSize = true;
		this.label1.Location = new System.Drawing.Point(102, 33);
		this.label1.Name = "label1";
		this.label1.Size = new System.Drawing.Size(106, 15);
		this.label1.TabIndex = 0;
		this.label1.Text = "最小峰宽(s)：";
		this.label2.AutoSize = true;
		this.label2.Location = new System.Drawing.Point(116, 67);
		this.label2.Name = "label2";
		this.label2.Size = new System.Drawing.Size(92, 15);
		this.label2.TabIndex = 0;
		this.label2.Text = "阈值(cps)：";
		this.label3.AutoSize = true;
		this.label3.Location = new System.Drawing.Point(48, 106);
		this.label3.Name = "label3";
		this.label3.Size = new System.Drawing.Size(160, 15);
		this.label3.TabIndex = 0;
		this.label3.Text = "最小峰面积(cps·s)：";
		this.label4.AutoSize = true;
		this.label4.Location = new System.Drawing.Point(86, 140);
		this.label4.Name = "label4";
		this.label4.Size = new System.Drawing.Size(122, 15);
		this.label4.TabIndex = 0;
		this.label4.Text = "最小峰高(cps)：";
		this.textBox1.Location = new System.Drawing.Point(262, 64);
		this.textBox1.Name = "textBox1";
		this.textBox1.Size = new System.Drawing.Size(114, 25);
		this.textBox1.TabIndex = 1;
		this.textBox1.Text = "10";
		this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.textBox2.Location = new System.Drawing.Point(262, 30);
		this.textBox2.Name = "textBox2";
		this.textBox2.Size = new System.Drawing.Size(114, 25);
		this.textBox2.TabIndex = 2;
		this.textBox2.Text = "10";
		this.textBox2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.textBox3.Location = new System.Drawing.Point(262, 102);
		this.textBox3.Name = "textBox3";
		this.textBox3.Size = new System.Drawing.Size(114, 25);
		this.textBox3.TabIndex = 1;
		this.textBox3.Text = "5000";
		this.textBox3.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.textBox4.Location = new System.Drawing.Point(262, 136);
		this.textBox4.Name = "textBox4";
		this.textBox4.Size = new System.Drawing.Size(114, 25);
		this.textBox4.TabIndex = 1;
		this.textBox4.Text = "1200";
		this.textBox4.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
		this.button1.Location = new System.Drawing.Point(430, 112);
		this.button1.Name = "button1";
		this.button1.Size = new System.Drawing.Size(76, 27);
		this.button1.TabIndex = 3;
		this.button1.Text = "取消";
		this.button1.UseVisualStyleBackColor = true;
		this.button1.Click += new System.EventHandler(button1_Click);
		this.button2.Location = new System.Drawing.Point(430, 62);
		this.button2.Name = "button2";
		this.button2.Size = new System.Drawing.Size(76, 27);
		this.button2.TabIndex = 3;
		this.button2.Text = "确定";
		this.button2.UseVisualStyleBackColor = true;
		this.button2.Click += new System.EventHandler(button2_Click);
		this.chkArea.AutoSize = true;
		this.chkArea.Location = new System.Drawing.Point(29, 105);
		this.chkArea.Name = "chkArea";
		this.chkArea.Size = new System.Drawing.Size(18, 17);
		this.chkArea.TabIndex = 4;
		this.chkArea.UseVisualStyleBackColor = true;
		this.chkPeak.AutoSize = true;
		this.chkPeak.Location = new System.Drawing.Point(64, 139);
		this.chkPeak.Name = "chkPeak";
		this.chkPeak.Size = new System.Drawing.Size(18, 17);
		this.chkPeak.TabIndex = 4;
		this.chkPeak.UseVisualStyleBackColor = true;
		this.groupBox1.Controls.Add(this.chkPeak);
		this.groupBox1.Controls.Add(this.chkArea);
		this.groupBox1.Controls.Add(this.textBox2);
		this.groupBox1.Controls.Add(this.textBox4);
		this.groupBox1.Controls.Add(this.textBox3);
		this.groupBox1.Controls.Add(this.textBox1);
		this.groupBox1.Controls.Add(this.label4);
		this.groupBox1.Controls.Add(this.label3);
		this.groupBox1.Controls.Add(this.label2);
		this.groupBox1.Controls.Add(this.label1);
		this.groupBox1.Location = new System.Drawing.Point(12, 12);
		this.groupBox1.Name = "groupBox1";
		this.groupBox1.Size = new System.Drawing.Size(385, 176);
		this.groupBox1.TabIndex = 5;
		this.groupBox1.TabStop = false;
		this.groupBox1.Text = "参数设置";
		this.errorProvider1.ContainerControl = this;
		base.AutoScaleDimensions = new System.Drawing.SizeF(8f, 15f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		base.ClientSize = new System.Drawing.Size(546, 205);
		base.Controls.Add(this.groupBox1);
		base.Controls.Add(this.button2);
		base.Controls.Add(this.button1);
		base.Name = "FormPeakSet";
		this.Text = "积分设置";
		base.Load += new System.EventHandler(FormPeakSet_Load);
		this.groupBox1.ResumeLayout(false);
		this.groupBox1.PerformLayout();
		((System.ComponentModel.ISupportInitialize)this.errorProvider1).EndInit();
		base.ResumeLayout(false);
	}
}
